package plus;
/**
 * Represents a type parameter in a "prototype".
 * provides the index of the parameter within the template.
 * Recall that parameters must be fully substituted out of existence to make
 * concrete types.
 * 
 */
final class S_Formal extends Solution {
	final int index;
	public S_Formal(int index) { this.index = index; }
	@Override
	void conform_to(Solution that, Gamma gamma) {
		// This can happen while elaborating typedefs.
		// Establish the assignment in the Gamma.
		throw new RuntimeException("not ready for formal type paramters to \"conform\" yet...");
	}

	@Override
	public void unify_with(Solution that) {
		// This might happen with typedefs -- not sure.
		if (this != that) Type.mismatch("Formal parameter", "Formal parameter");
	}

	@Override Solution copy() {
		// I guess this isn't supposed to happen.
		// Copies happen at function call sites, but types of actual functions
		// should not presently be able to contain formal type parameters.
		assert false;
		throw null;
	}
	@Override Type subst(Type[] actuals) {
		//System.out.println("Substituting Formal Parameter "+index);
		return actuals[index];
	}
	@Override boolean isNullable() { throw null; }
	@Override boolean canConform(Solution that, Hypo h) {
		throw null;
	}
}
